import request from '@/utils/request'
import axios from 'axios'
export function uploadImage(params) {
  return new Promise(function(resolve, reject) {
    var formData = new FormData()
    for (const i in params) {
      formData.append([i], params[i])
    }
    axios.post(process.env.VUE_APP_BASE_API + '/upload', formData).then(res => {
      res = res.data
      if (res.data) {
        resolve(res.data.url)
      } else {
        reject(res)
      }
    })
  })
}
